<template>
  <div class="wrap">
    <div class="commentWrap">
      <div class="commentItem" v-for="(item, index) in resGoodsComment" :key="index">
        <img :src="$imgUrl + item.headImage" alt="" class="commentLeft" />
        <div class="commentRight">
          <div class="name">
            <em class="nameText">{{ item.nickName }}</em>
            <em class="point">{{ item.createTime }}</em>
          </div>
          <div class="commentText">
            <div class="remarkText">阿发是否是否</div>
            <div class="imgWrap">
              <img :src="$imgUrl+itemImg" alt="" v-for="(itemImg,indexImg) in item.commentImg" :key="indexImg"/>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Field, Dialog } from "vant";
import { apiGetGoodsCommentList } from "@/request/api"; // api接口
export default {
  name: "App",
  data() {
    return {
      show: false,
      showComment: false,
      GoodsId: this.$route.query.GoodsId,
      resGoodsComment: [],
    };
  },
  mounted() {
    document.querySelector("body").setAttribute("style", "background-color:#F2F4FA");
    this.getGoodsCommentList();
  },
  methods: {
    //用户评价
    getGoodsCommentList() {
      apiGetGoodsCommentList({
        id: this.GoodsId,
      }).then((res) => {
        this.resGoodsComment = res.data;
        this.resGoodsComment.map(item=>{
            item.commentImg =item.commentImg.split(",");
         })
        console.log('this.resGoodsComment',this.resGoodsComment)
      });
    },
  },
  created() {},
  components: {
    [Field.name]: Field,
    [Dialog.name]: Dialog,
  },
};
</script>

<style scoped>
.redHeart {
  width: 13px;
  height: 11px;
}
.number {
  font-size: 10px;
  font-weight: 300;
  color: #181818;
  padding-left: 5px;
}
.commentWrap {
  width: 100%;
  background-color: #fff;
  border-radius: 20px 20px 0px 0px;
  margin-top: 10px;
  min-height: 99vh;
}
.commentItem {
  padding: 15px 0px;
  overflow: hidden;
  border-bottom: 1px solid #e5e5e5;
}
.commentLeft {
  width: 37px;
  height: 37px;
  border-radius: 37px;
  float: left;
  margin-left: 15px;
}
.commentRight {
  width: calc(100% - 30px - 37px - 10px);
  margin-left: 10px;
  float: left;
  font-weight: 400;
  color: #181818;
  font-size: 12px;
}
.name {
  font-size: 11px;
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.nameText {
  display: inline-block;
}
.point {
  color: #999999;
}
.commentText {
  margin-top: 10px;
}
.remarkText {
}
.imgWrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.imgWrap img {
  width: 30%;
  max-height: 100px;
  margin-top: 15px;
}
.commStatisticsWrap {
  width: calc(100% - 12px);
  padding-bottom: 15px;
  margin-top: 13px;
}
.date {
  float: left;
  font-size: 10px;
  font-weight: 300;
  color: #999999;
}
.commStatisticsItem {
  float: right;
}
.number2 {
  font-size: 10px;
  font-weight: 300;
  color: #999999;
}
.maskWrap {
}
.maskBg {
  width: 100%;
  min-height: 100vh;
  opacity: 0.35;
  background-color: #000;
  position: fixed;
  top: 0px;
}
.chooseNumWrap {
  width: 100%;
  background-color: #fff;
  position: fixed;
  bottom: 0px;
  border-radius: 20px 20px 0px 0px;
}
.inputComment {
  height: 100px;
}
.inputComment .van-cell {
  height: 80px !important;
}
.sendComment {
  float: right;
  margin-right: 5%;
  margin-top: 23px;
  background-color: #ff955e;
  font-size: 14px;
  padding: 5px 12px;
  border-radius: 5px;
  color: #fff;
}
.optionsItem {
  height: 50px;
  line-height: 50px;
  border-bottom: 1px solid #eee;
  color: #000;
  font-size: 14px;
  text-align: center;
}
.dele {
  background-color: #eee;
  border-radius: 20px;
  width: 90%;
  margin: 5px auto;
  height: 40px;
  line-height: 40px;
}
.commentRemark {
  width: 100%;
  position: fixed;
  bottom: 0;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0px 3px 12px 0px rgba(0, 0, 0, 0.12);
  border-radius: 24px 24px 0px 0px;
}
.input {
  float: left;
  border-radius: 20px;
  width: 70%;
  margin: 15px 20px;
}
.van-cell {
  border-radius: 20px;
  background-color: #f2f4fa;
}
.at {
  float: left;
  width: 18px;
  height: 18px;
  margin-top: 30px;
}
.emg {
  float: left;
  width: 18px;
  height: 18px;
  margin: 0px 20px 0px 16px;
  margin-top: 30px;
}
</style>
